package com.example.barcodeapp.persenter;

import com.example.barcodeapp.base.BasePersenter;
import com.example.barcodeapp.common.CommonSubscriber;
import com.example.barcodeapp.interfaces.own.IOwn;
import com.example.barcodeapp.model.HttpManager;
import com.example.barcodeapp.ui.own.bean.HuoDongBean;
import com.example.barcodeapp.ui.own.bean.KeChengBean;
import com.example.barcodeapp.utils.RxUtils;

public class OnePresenterHuoDong extends BasePersenter<IOwn.Viewkechenghuodong> implements IOwn.Persenterkechenghuodong {


    @Override
    public void getKeChengHuoDong(int page, int huodong_type, int huodong_date, int keywords, int province, int city, int area) {
        addSubscribe(HttpManager.getInstance().getOwnTpApi().gethuodong(page,huodong_type,huodong_date,keywords,province,city,area)
                .compose(RxUtils.rxScheduler())
                .subscribeWith(new CommonSubscriber<HuoDongBean>(mView) {
                    @Override
                    public void onNext(HuoDongBean hanFuDaBean) {
                        mView.getKeChengHuoDong(hanFuDaBean);
                    }
                }));
    }

    @Override
    public void getKeChengHuoDong(int l_id) {
        addSubscribe(HttpManager.getInstance().getOwnTpApi().gethuodong(l_id)
                .compose(RxUtils.rxScheduler())
                .subscribeWith(new CommonSubscriber<HuoDongBean>(mView) {
                    @Override
                    public void onNext(HuoDongBean hanFuDaBean) {
                        mView.getKeChengHuoDong(hanFuDaBean);
                    }
                }));
    }
}
